﻿Imports System.Data.SqlClient
Public Class Conexion
    Protected Shared cnn As New SqlConnection
    Protected Shared Function conectar() As Boolean
        Try
            Dim conexion As String = My.Settings.INVE_FISHConnectionString
            cnn = New SqlConnection(conexion)
            cnn.Open()
            Return True
        Catch ex As Exception
            MessageBox.Show(ex.Message, "Advertencia", MessageBoxButtons.OK,
                            MessageBoxIcon.Warning)
            Return False
        End Try
    End Function
    Protected Shared Function desconectar() As Boolean
        Try
            If cnn.State = ConnectionState.Open Then
                cnn.Close()
                Return True
            Else
                Return False
            End If
        Catch ex As Exception
            MessageBox.Show(ex.Message, "Advertencia", MessageBoxButtons.OK,
                            MessageBoxIcon.Warning)
            Return False
        End Try
    End Function


End Class
